home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -websites- / wirenet / files / wirenet151.lzx / Updates / Fetch < prev    next >
Text File  |  1999-11-06  |  2KB  |  81 lines

  1. /* $VER: Fetch 1.5 (01.09.96) (c) Neil Bothwick        */
  2. /*                                                     */
  3. /* Gets mail and/or news, retrying until a connection  */
  4. /* is made or a maximum number of retries is reached   */
  5.  
  6. /* Change these to suit your setup */
  7.  
  8. SystemName = 'Wirenet'                          /* The name of your Internet system in Thor */
  9. NumSockets = 2                                  /* The number of sockets for Thor to use */
  10. MaxTries   = 5                                  /* Maximum number of retries */
  11. Logging    = 0                                  /* Set to 1 to enable logging, 0 to disable it */
  12.                                                 /* DO NOT use logging unless you have at least Thor 2.3 */
  13. LogFile    = 'UUSpool:Connect.log'
  14.  
  15. /* Don't change anything below here */
  16.  
  17. arg option
  18.  
  19. if ~show('L','rexxdossupport.library') then
  20.   call addlib('rexxdossupport.library',0,-30)
  21.  
  22. options results
  23. address command
  24. options failat 21
  25.  
  26. /* :Check to see if fetch is already running */
  27. if exists('ENV:FetchState') then call ExitMsg('Fetch is already collecting' GetVar('FetchState'))
  28. ;;
  29. /* :Read password from PAP config */
  30. Password = subword(GetVar('Wirenet/pap.config'),2)
  31. ;;
  32. /* :Build command string */
  33. CmdStr = GetVar('Thor/ThorPath')'bin/GetTCP' SystemName 'PUBSCREEN Workbench GETONLY'
  34. MailStr = 'DELETE PASSWORD' Password 'MAILSERVER $MAILSERVER USERNAME $MAILBOX'
  35. NewsStr = 'NEWSSERVER $NEWSSERVER SOCKETS' NumSockets
  36.  
  37. select
  38.     when option = 'MAIL' then do
  39.         CmdStr = CmdStr 'NONEWS' MailStr
  40.         'setenv FetchState mail'
  41.         end
  42.     when option = 'NEWS' then do
  43.         CmdStr = CmdStr 'NOMAIL' NewsStr
  44.         'setenv FetchState news'
  45.         end
  46.     when option = 'ALL' then do
  47.         CmdStr = CmdStr MailStr NewsStr
  48.         'setenv FetchState mail & news'
  49.         end
  50.     otherwise ExitMsg('Usage: Fetch Mail|News|All')
  51.     end
  52.  
  53. if Logging = 1 then CmdStr = CmdStr 'LOGFILE' LogFile
  54. ;;
  55. /* :Call ParseThor to remove any batched mail or news in tcp_tmp */
  56. 'AmiTCP:bin/ParseThor'
  57. ;;
  58. /* :Call GetTCP until successful or max retries reached */
  59. do try = 1 to MaxTries
  60.     CmdStr
  61.     if RC=0 then do
  62.         leave try
  63.         end
  64.     end
  65.  
  66. 'unsetenv FetchState'
  67.  
  68. if try > MaxTries then ExitMsg('Failed to get mail after' MaxTries 'attempts')
  69. ;;
  70.  
  71. exit
  72.  
  73. ExitMsg: Procedure
  74.     parse arg Msg
  75.     say
  76.     say(Msg)
  77.     say
  78.     exit
  79.     return
  80.  
  81.